import React, { Component } from 'react'
import 'antd/dist/antd.css';
import stroe from './redux/store'
// 引入action对象
import {createAddMsg,createNoaddMsg} from './redux/count_action'
export default class App extends Component {
    // componentDidMount(){
    //     // 检测redux的变化
    //     stroe.subscribe(()=>{
    //         this.forceUpdate()//强刷新
    //     })
    // }
    add = () =>{
        stroe.dispatch(createAddMsg(1))
    }
    noadd = () =>{
        stroe.dispatch(createNoaddMsg(1))
    }
    render() {
        return (
            <div>
                当前求和为：{stroe.getState()}
                <button onClick={this.add}>相加</button>
                <button onClick={this.noadd}>相减</button>
            </div>
        )
    }
}
